<template>
	<!-- 自定义组件 -->
	<view @click="searchBoxHandler" class="search-box" :style="{'background-color': bgcolor}">
		<view class="input-box" :style="{'border-radius': radius + 'px'}">
			<uni-icons type="search"></uni-icons>
			<text class="placeholder">搜索</text>
		</view>
	</view>
</template>

<script>
	export default {
		name:"my-search",
		props: {
			// 背景颜色
			bgcolor: {
				type: String,
				default: '#C00000'
			},
			// 圆角尺寸
			radius: {
				type: Number,
				default: 18
			}
		},
		data() {
			return {
				
			};
		},
		methods: {
			searchBoxHandler() {
				// 绑定click事件
				this.$emit('myclick')
			}
		}
	}
</script>

<style lang="scss">
.search-box {
	// background-color: #C00000;
	padding: 0 10px;
	height: 50px;
	display: flex;
	align-items: center;
	.input-box {
		background-color: #fff;
		// border-radius: 20px;
		width: 100%;
		height: 36px;
		line-height: 36px;
		text-align: center;
		.placeholder {
			margin: 0 10px;
		}
	}
}
</style>